<include file="Public:header"/>
<section class="panel-default">
    <section class=" panel-default">
        <div class="btn-group " style="width: 100%;">
            <a href="{:U('WorkOrder/workList')}" class="btn btn-default btn-lg col-xs-6"><i class="fa fa-list"></i> 工单列表</a>
            <a href="{:U('WorkOrder/workadd')}" class="btn btn-info btn-lg col-xs-6"><i class="fa fa-file-text"></i> 新建工单</a>
        </div>
        <section class=" panel-default">
            <div class="m-b-sm">
                <if condition="$_list eq null">
                    <h4 class="text-center m-t">没有工单信息!</h4>
                    <else/>
                    <ul class="list-group alt">
                        <volist name="_list" id="vo" key="k">
                            <li class="list-group-item">
                                <a class="media" href="#model-info" data-toggle="modal" onclick="funs({$k},{$vo.status})">
                                    <div class="pull-right text-success m-t-sm">
                                        <i class="fa fa-chevron-right icon-muted"></i>
                                    </div>
                                    <input type="hidden" id="srv{$k}" value='{$vo|json_encode}' />
                                    <div class="media-body">
                                        <h4>{$vo.title}</h4>
                                        <small class="text-muted">{$vo.create_time|date='Y-m-d H:i:s',###}</small>
                                        <if condition="$vo.status eq 0">
                                            <span class="btn btn-danger btn-xs pull-right">待处理</span>
                                            <elseif condition="$vo.status eq 1"/>
                                            <span class="btn btn-warning btn-xs pull-right">处理中</span>
                                            <elseif condition="$vo.status eq 2"/>
                                            <span class="btn btn-success btn-xs pull-right">已完成</span>
                                            <!--<span class="btn btn-warning btn-xs pull-right m-r">删除</span>-->
                                        </if>

                                    </div>
                                </a>
                            </li>
                        </volist>
                    </ul>
                </if>

            </div>
        </section>
    </section>
</section>

<!--工单信息弹框-->
<div class="modal fade" id="model-info">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                <div class="form-group">
                    <h4>标题:<span id="title"></span></h4>
                    <p>提交时间：<span class="text-danger" id="create_time"></span></p>
                    <p>内容:<span id="content"></span></p>
                    <div><img id="img_1" src="" class="img-responsive"/></div>
                    <h4>反馈内容:</h4>
                    <p id="tocontent"></p>
                    <div id="vive">
                    <a  id="competition" href="" class="ajax-get btn btn-primary block m-t"><i class="fa fa-check-circle-o"></i>完成</a>
                    <a id="workupdate" href="" class="btn btn-danger block m-t"><i class="fa fa-edit"></i> 修改工单</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!--详细信息弹框 end-->
<include file="Public:footer"/>
<script src="__PUBLIC__/Static/js/app.v2.js"></script>
<script>

    function funs(id,status){
        if(status==1){

            $("#vive").show();
        }else{
            $("#vive").hide();
        }
        $("#workupdate").attr('href',"{:U('WorkOrder/wordUpdate')}?wid="+id);
        $("#competition").attr('href',"{:U('WorkOrder/comwork')}?wid="+id);
        var data=$("#srv"+id).val();
        var obj = eval('(' + data + ')');
        console.log(obj);
        $("#title").html(obj.title);
        $("#content").html(obj.content);
        $("#create_time").html(getLocalTime(obj.create_time));
        $("#tocontent").html(obj.tocontent);
        $("#img_1").attr('src',obj.img_url1);

    }
</script>